<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<style type="text/css" media="all">
html, body {
	height: 100%
}

body {
	margin: 0px;
	padding: 0px;
	overflow: hidden;
	font-size: 12px;
	font-family: "Microsoft YaHei", SimSun, Arial, Sans-Serif;
}

td {
	font-size: 12px;
}

#pageindex {
	text-align: center;
	height: 14px;
	line-height: 1;
	margin: 0;
}

.display_c {
	font-family: "Microsoft Yahei", "SimSun";
	font-size: 10pt;
	float: left;
	height: 16px;
	line-height: 16px;
	margin-left: 4px;
}

.queryview-toolbar-button {
	height: 18px;
	width: 48px;
	display: inline-block;
	cursor: pointer;
	background-color: transparent;
	background-repeat: no-repeat;
	background-position: left center;
	border: none;
	font-size: 12px;
	margin: 2px;
}

.queryview-export {
	width: 60px;
	padding: 0 5px;
	border: 1px solid #ccc;
	position: absolute;
	background: #f6f6f5;
	z-index: 990;
	margin-left: 80px;
	margin-top: 0;
	display: none;
}

.queryview-export a {
	color: #00B0F0;
	text-decoration: none;
	display: block;
}

.queryview-export a:hover {
	background: #277b9d;
	color: #fff;
}

.queryview-toolbar-refresh {
	background: url(${request.contextPath}/statics/images/pageImg3.png) no-repeat;
	margin-top: 8px;
	margin-left: 30px;
}

.queryview-toolbar-export {
	background: url(${request.contextPath}/statics/images/pageImg1.png) no-repeat;
}

.queryview-toolbar-print {
	background: url(${request.contextPath}/statics/images/pageImg2.png) no-repeat;
}

.queryview-toolbar-refreshzd {
	background: url(${request.contextPath}/statics/images/pageImg4.png) no-repeat;
}

.queryview-toolbar-save {
	background: url(${request.contextPath}/statics/images/pageImg5.png) no-repeat;
}

#searchaddition span {
	margin-right: 10px;
}

#prefrm {
	width: 100%;
	min-height: 100px;
	height: 100%;
}

.tr-toolbars {
	background-color: #E6E5E5;
}
</style>
<script src="${request.contextPath}/statics/rdp/common/all/jquery-1.11.0.js"></script>
<script src="${request.contextPath}/statics/rdp/common/lib/layer/layer.js"></script>
<script src="${request.contextPath}/statics/rdp/js/common.js"></script>
<script src="${request.contextPath}/statics/rdp/lib/fileDownload.js"></script>
<script type="text/javascript" src="${request.contextPath}/statics/libs/base64Util.js"></script>
<!-- 打印 -->
<script>var content_path='${request.contextPath}';</script>
<!-- 免费 -->
<script src="${request.contextPath}/statics/print/free.js"></script>
<!-- 授权
<script src="${request.contextPath}/statics/print/jcp.js"></script>
<script src="${request.contextPath}/statics/print/lic.js"></script>
<script src="${request.contextPath}/statics/print/license.js"></script> -->
<script type="text/javascript">
var ispubu=false;//瀑布流
var isJb=false;// 是否javabean自定义分页
var totalRecord=0;
var page=1;
<#if RequestParameters["totalRecord"]?exists && RequestParameters["totalRecord"] != "" && RequestParameters["totalRecord"] != "0">
isJb=true;
totalRecord=${RequestParameters["totalRecord"]};
</#if>
var pageflag=0;
var jsonStr='';
<#if RequestParameters["page"]?exists>
page=${RequestParameters["page"]};
</#if>
var uuid='${uuid}';
var subreport=false;//主子报表
var fillreport=false;//填报报表
	var isset=0;
	var dicData={};
    $(function(){
        $('.queryview-export').hover(function(){$(this).show();},function(){$(this).hide();});	
        
        $("#pageindex").bind("keydown",function(event){
			oninputkeydown(event);
		});
        $("#pagesize").change(function(){
        pageflag=1;
        	init(page);
        });
    });
    
    
    function oninputkeydown(event) {
		if(event.keyCode == 13){   
			var i=parseInt($('#pageindex').val());
			var t=parseInt($('#pagecount').html());
			if(i<=t&&i>=1){init(i);}
		 }   
	}
	
    function setpage(pageindex,pagecount){
	if(pageindex>0&&pageindex<=pagecount){
		if(pageindex==pagecount){
			if(pageindex==1&&pagecount==1){
				$('#pagefirst').attr('disabled',true)
				$('#pagepre').attr('disabled',true);
				$('#pagenext').attr('disabled',true);
				$('#pagelast').attr('disabled',true);
				}else if(pageindex==1){
				$('#pagefirst').attr('disabled',true)
				$('#pagepre').attr('disabled',true);
				$('#pagenext').attr('disabled',false);
				$('#pagelast').attr('disabled',false);
				}else{
					$('#pagefirst').attr('disabled',false);
					$('#pagepre').attr('disabled',false);
					$('#pagenext').attr('disabled',true);
					$('#pagelast').attr('disabled',true);
					}
			}else{
				$('#pagefirst').attr('disabled',false)
				$('#pagepre').attr('disabled',false);
				$('#pagenext').attr('disabled',false);
				$('#pagelast').attr('disabled',false);
				}
				$('#pageindex').val(pageindex);
				$('#pagecount').html(pagecount);
	}
	if(isJb){$('#pageparm').show();}
	}
	function first(){if(isJb){parent.searchpage(1)}else{init(1);}}
	function prep(){var i=parseInt($('#pageindex').val());var t=parseInt($('#pagecount').html());if(i<=t&&i>1){if(isJb){parent.searchpage(i-1)}else{init(i-1);}}}
	function nextp(){var i=parseInt($('#pageindex').val());var t=parseInt($('#pagecount').html());if(i<t){if(isJb){parent.searchpage(i+1)}else{init(i+1);}}}
	function last(){var t=parseInt($('#pagecount').html());if(isJb){parent.searchpage(t)}else{init(t);}}
    function initMain(){
        try{
        if(parent.jsonStr!=undefined&&parent.jsonStr!=''){jsonStr=parent.jsonStr;$('#reportJson').val(Base64Util.encode64(JSON.stringify(jsonStr)));}
        }catch(e){}
        if(isJb){
        init(page);
        }else{
        init(1);
        }
    }
    
    function init(page){ 
        getSearch(page);
    } 
    
    
    function getSearch(page){
        var url = "${request.contextPath}/rdppub/show";
        var pageSize,pageType;
			if(pageflag==0){
			if(jsonStr!=''){
        	pageSize=parent.jsonStr.page;
        	$("#pagesize").val(pageSize);
        	}else{
        	pageSize=0;
        	}
        	}else{
        	pageSize=$("#pagesize").val();
        	}
        	if(jsonStr!=''){
        	pageType=parent.jsonStr.pageorder;
        	}else{
        	pageType='1';
        	}
            var urlsub=url+"?opt=previewNew&currentPage="+page+"&pageSize="+pageSize+"&pageType="+pageType;
            
    var  url=url+"?uuid="+uuid+"&opt=previewNew&currentPage="+page+"&pageSize="+pageSize+"&pageType="+pageType+"&totalRecord="+totalRecord;
        $.ajax({
            url : url, 
            data:$('#exportData').serialize(),
            type:"post",
            async:true,
            success : function(ddd) {
            if(ddd.code==0){
            var data=ddd.list;
            try{if(parent.document&&parent.initParm!=undefined){
                //parent.initParm(0);
                parent.document.title=data.title;
                }
                }catch(e){}
            	if(data.expires!='0'){
            		$('#license').html(data.exprisemsg);
            	}
            	if(pageflag==0&&jsonStr==''){$("#pagesize").val(data.pageSize);}
            	var dbody=$('<div>'+data.body+'</div>');
            	var ncss='<style type="text/css" media="all">'+data.css+'</style>';
            	document.title=data.title;
            	var newbody=ncss+dbody.html();
            	subreport=data.subreport;
            	fillreport=data.fillreport;
            	if(fillreport){
            	$('.btnexport').hide();$('.btnfillreport').show();
            	}
                if(page==1){
                	if(!isJb){totalRecord=parseInt(data.totalRecord);}
                	if(totalRecord>0&&!subreport){
                	if(isJb){
                	 $('#totalrecord').html(totalRecord);
                	}else{
	                $('#totalrecord').html(data.totalRecord);
                	}
	                if(!subreport){//主子报表不显示总记录数
	                $('#totalrecord').parent('label').show();
	                }
	                }
                	if(data.pageSize!=-2){if(!subreport&&data.pageSize!=-1){$('#pageparm').show();}}else{ispubu=true;}
                }
                $("#prefrm")[0].contentWindow.frmChild(newbody,(pageSize==0?$('input[name="printfx"]:checked').val():3),data.currentPage);
                if(!isJb){setpage(data.currentPage,data.totalPage);}else{setpage(page,parseInt((totalRecord + data.pageSize -1) / data.pageSize));}
                /* if(data.toolbar=='bottom'){//下工具栏
                	$('.queryview-export').css('bottom','1px');
                	$('.rt-parmlist',parent.document).css('top','0').css('bottom','34px');
                	var toolbar=$('._trToolbar');
                	$('._trToolbar').detach();
                	toolbar.insertAfter('#maintr');
                } */
                }else{
                alert('请求失败，'+ddd.msg);
                }
            },
            error:function(){alert('数据加载出错，请联系管理员！');},
            beforeSend:function(){layer.load(2, {
			    shade: false, 
			    content: '正在加载第'+page+'页',
			    success: function (layero) {
			        layero.find('.layui-layer-content').css({
			            'padding': '9px 0 0 40px',
			            'width': '200px',
			             'color': '#1E9FFF'
			        });
			    }
			});},
            complete:function(){setTimeout("layer.closeAll('loading')",200)}
        });
    	
    	
    }
    
    //导出文件
    function exportFile(type) {
    	$.ajax({
            url : '${request.contextPath}/rdppub/exportFlag?uuid='+uuid, 
            type:"post",
            async:true,
            success : function(data) {
            	if(data.code==0){
		    	layer.load(2, {
				    shade: [0.5, 'black'], 
				    content: '导出中……',
				    success: function (layero) {
				        layero.find('.layui-layer-content').css({
				            'padding': '9px 0 0 40px',
				            'width': '60px',
				             'color': '#1E9FFF'
				        });
				    }
				});
		    	$(".queryview-export").hide();
		    	var url = "${request.contextPath}/rdppub/exportFile?export_type=" + type+"&uuid="+uuid;
		    	if(subreport){
		    		url = "${request.contextPath}/rdppub/exportSubFile?export_type=" + type+"&uuid="+uuid;
		    	}
			    	$.fileDownload(url,{data:$('#exportData').serialize(),httpMethod:'POST',
			    	 successCallback: function (url) { layer.closeAll('loading') },
			    	 failCallback: function (responseHtml, url) { $.get('${request.contextPath}/rdppub/exportFlag?uuid='+uuid+'&stat=1');layer.closeAll('loading');alert("导出失败！")}
			    	});
            	}else{
            		alert('当前报表正在导出或导出已达最大数目，请稍候再来导出');
            	}
            }
    	});
	}
    
    //动态参数保存并刷新子页面
    function search(){
    	 $("#prefrm")[0].contentWindow.refresh();
    }
    
</script>

<!--[if lte IE 7]>
<script type="text/javascript">
$(function(){
function onresize() { 
window.detachEvent("onresize", onresize);
$("#prefrm").height((document.documentElement.clientHeight - $('#miantdh').offset().top)-80);
 window.attachEvent("onresize", onresize); 
} 
window.attachEvent("onresize", onresize);
});
</script>
<![endif]-->
<!--[if gt IE 7]>
<script type="text/javascript">
$(function(){
function onresize() { 
window.detachEvent("onresize", onresize);
$("#prefrm").height((document.documentElement.clientHeight - $('#miantdh').offset().top)-50);
 window.attachEvent("onresize", onresize); 
} 
window.attachEvent("onresize", onresize);
});
</script>
<![endif]-->
</head>

<body>
	<div class="queryview-export">
		<p>
			<a href="javascript:exportFile('excel')">EXCEL</a>
		</p>
		<p>
			<a href="javascript:exportFile('word')">WORD</a>
		</p>
		<p>
			<a href="javascript:exportFile('pdf')">PDF</a>
		</p>
		<form action="" id="exportData" method="post" style="display: none;">
			<#if hideitems?exists> <#list hideitems as item> <#if item.name!="reporttype" && item.name!="uuid" && item.name!="list"> <input type="hidden" name="${item.name}" id="${item.name}" value="${item.value}"> </#if> </#list> </#if>

			<textarea name="jsonlist" id="jsonlist" style="display: none;">
			<#if RequestParameters["list"]?exists>
			${RequestParameters["list"]}
			</#if>
			</textarea>
			<textarea name="reportJson" id="reportJson" style="display: none;"></textarea>
			<input id="frmsub" type="submit" />
		</form>
	</div>
	<table style="width: 100%; height: 100%; table-layout: fixed;" border="0" cellspacing="0" cellpadding="0">
		<tbody>
			<tr height="100%" width="100%">
				<td class="_outerFrame" valign="top" height="100%"><div class="_frameViewContainer" style="width: 100%; height: 100%; overflow: hidden;">
						<div style="height: 100%;">
							<table width="100%" height="100%" class="_outerTable" style="table-layout: fixed;" border="0" cellspacing="0" cellpadding="0">
								<tbody>

									<tr class="_content" style="width: 100%; height: 100%;" valign="top">
										<td height="100%"><span></span>
											<table width="100%" height="100%" cellspacing="0" cellpadding="0">
												<tbody>
													<!--BeginToobar-->
													<tr height="26" class="_trToolbar queryview-toolbar" valign="top">
														<td class="toolbarBg"><table style="width: 100%; table-layout: fixed;" cellspacing="0" cellpadding="0">
																<tbody>
																	<tr>
																		<td><div style="width: 100%; overflow: hidden;">
																				<div style="width: 100%; position: relative; height: 33px; line-height: 33px; border-top: 1px solid #ccc; border-bottom: 1px solid #ccc;">
																					<table height="26" style="border-collapse: separate;" cellspacing="0" cellpadding="0">
																						<tbody>
																							<tr class="tr-toolbars">
																								<td class="queryview-toolbar-button-normal"><input title="打印" class="_btnPrint queryview-toolbar-button queryview-toolbar-print" style="margin: 0 15px; width: 48px; padding-left: 20px; background-position-x: left;" type="button" value="打印 " onclick="doPrint('打印...')"></td>
																								<td class="queryview-toolbar-button-normal btnexport"><input title="导出" class="_btnExport queryview-toolbar-button queryview-toolbar-export" style="width: 48px; padding-left: 20px; background-position-x: left;" type="button" value="导出" onMouseOver="$('.queryview-export').show();"></td>
																								<td class="queryview-toolbar-button-normal btnfillreport" style="display: none"><input title="保存" class="_btnPrint queryview-toolbar-button queryview-toolbar-save" style="margin: 0 15px; width: 48px; padding-left: 20px; background-position-x: left;" type="button" value="保存 " onclick="$('#prefrm')[0].contentWindow.fill_save()"></td>
																								<!-- <td class="queryview-toolbar-button-normal"><label><input title="纵向" value="1" type="radio" name="printfx" checked="checked" onclick="prefrm.refresh();"> 纵向</label> <label><input title="纵向" value="2" type="radio" name="printfx" onclick="prefrm.refresh();"> 横向</label></td>-->
																								<td nowrap="" style="width: 100%; padding-right: 10px; text-align: right;"><label style="display: none">总记录：<span id="totalrecord">0</span>条
																								</label> <label id="pageparm" style="display: none"> <select name="pagesize" id="pagesize"><option value="0">自动分页</option>
																											<option value="-1">不分页</option>
																											<option value="10" selected="selected">10条/页</option>
																											<option value="20">20条/页</option>
																											<option value="30">30条/页</option>
																											<option value="40">40条/页</option>
																											<option value="50">50条/页</option>
																											<option value="100">100条/页</option></select> <input id="pagefirst" disabled="" class="queryview-toolbar-button" style="background-position: left top; width: 45px; margin-left: 10px; padding-left: 20px; background: url(${request.contextPath}/statics/images/first.png) left center no-repeat;" type="button" value="首页" onclick="first();"> <input id="pagepre" disabled="" class="queryview-toolbar-button" style="background-position: left top; width: 60px; padding-left: 15px; background-image: url(${request.contextPath}/statics/images/previous.png); background-repeat: no-repeat;" type="button" value="上一页" onclick="prep();"> <input style="width: 30px;" type="text" value="1" id="pageindex" title="输入页码回车确认"> / <span id="pagecount">1</span> 页 <input id="pagenext" disabled="" class="queryview-toolbar-button"
																										style="background-position: left top; width: 60px; padding-left: 15px; background-image: url(${request.contextPath}/statics/images/next.png); background-repeat: no-repeat;" type="button" value="下一页" onclick="nextp();"> <input id="pagelast" disabled="" class="queryview-toolbar-button" style="background-position: left top; width: 45px; padding-left: 20px; background: url(${request.contextPath}/statics/images/last.png) left center no-repeat;" type="button" value="尾页" onclick="last();">
																								</label></td>
																								<td><span class="_space2 queryview-toolbar-space"></span></td>
																						</tbody>
																					</table>
																				</div>
																			</div></td>
																	</tr>
																</tbody>
															</table></td>
													</tr>
													<!--EndToobar-->
													<tr height="100%" id="maintr">
														<td valign="top" height="100%" id="miantdh"><iframe name="prefrm" id="prefrm" src="${request.contextPath}/rdppage/view?iscellauto=${cellauto}" frameborder="0"></iframe></td>
													</tr>
												</tbody>
											</table></td>
									</tr>
								</tbody>
							</table>

						</div></td>
			</tr>
			<tr>
				<td id="license" style="text-align: center"></td>
			</tr>
		</tbody>
	</table>
	<div></div>

</body>
</html>